//
//  LZWriteNameCell.m
//  DoctorFAQs
//
//  Created by langZai on 2017/2/24.
//  Copyright © 2017年 zjq. All rights reserved.
//

#import "LZWriteNameCell.h"
@implementation LZWriteNameCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.textLabel.font = NEWFONT(15);
        self.textLabel.textColor = KHBlackColor;
        self.textLabel.text = @"姓名";
        _nameTextField = [[UITextField alloc] init];
        _nameTextField.delegate = self;
        _nameTextField.enabled = NO;
        _nameTextField.font = NEWFONT(15);
        //_nameTextField.backgroundColor = [UIColor redColor];
        _nameTextField.textColor = KHGaryColor;
        _nameTextField.placeholder = @"填写姓名";
        // 占位文字颜色
        [_nameTextField setValue:KHGaryColor forKeyPath:@"_placeholderLabel.textColor"];
        _nameTextField.textAlignment = NSTextAlignmentRight;
        [self.contentView addSubview:_nameTextField];
        [_nameTextField mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(200*xsIZE);
            make.height.equalTo(self.contentView);
            make.right.equalTo(self.contentView).offset(-10*xsIZE);
            make.centerY.equalTo(self.contentView);
        }];
        
        // 自定义tableView的分割线
        UIView *lineView = [[UIView alloc] init];
        lineView.backgroundColor = KHColorFromRGB(0xe0e0e0);
        [self.contentView addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(355*xsIZE);
            make.height.offset(0.5*ysIZE);
            make.left.equalTo(self.mas_left).offset(10*xsIZE);
            make.bottom.equalTo(self.contentView);
        }];
    }
    return self;
}
#pragma mark UITextField

- (void)textFieldDidEndEditing:(UITextField *)textField {
    if (textField.text.length > 0) {
        _returnNameBlock(textField.text);
    }
}

@end
